package branch.snapshot;

import java.io.Serializable;
import java.util.Calendar;
import java.util.HashSet;
import java.util.List;
import java.util.Set;

import branch.BranchDAO;


public class Marker implements Serializable {

	/**
	 * 
	 */
	private static final long serialVersionUID = 8091287727439521778L;

	private final int initiatorId;
	private final int snapshotCounter;
	private final Set<Integer> participatingBranchIds;
	
	public Marker(int initiatorId, int snapshotCounter, Set<Integer> participatingBranchIds) {
		this.initiatorId = initiatorId;
		this.snapshotCounter = snapshotCounter;
		this.participatingBranchIds = participatingBranchIds;
	}
	
	public int hashCode(){
		return initiatorId*1000 + snapshotCounter;
	}
	
	public boolean equals(Object obj){
		if (!(obj instanceof Marker))
            return false;
        if (obj == this)
            return true;
		
        Marker m = (Marker) obj;
        
		return 	initiatorId == m.initiatorId &&
				snapshotCounter == m.snapshotCounter;
	}
	
	public Set<Integer> getParticipatingBranchIds(){
		return new HashSet<Integer>(participatingBranchIds);
	}
	
	public int getInitiatorId(){
		return initiatorId;
	}
	
}
